package com.hzh.cusviewdemo.Base;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.tobey.dialogloading.DialogUtils;

public class LoadingImpl {

    private static Dialog loading;

    // 显示加载动画
    public static Dialog show(Context context) {
        loading = createLoading(context);
        loading.show();
        return loading;
    }

    public static Dialog show(Context context, String loadContent) {
        loading = createLoading(context, loadContent);
        loading.show();
        return loading;
    }


    public static void dismiss() {
        if (loading != null) {
            if (loading.isShowing()) {
                loading.dismiss();
                loading = null;
            }
        }
    }

    private static Dialog createLoading(Context context) {
        return DialogUtils.Companion.createLoading(context, "等一下,找歌中...");
    }

    private static Dialog createLoading(Context context, String loadContent) {
        return DialogUtils.Companion.createLoading(context, loadContent);
    }

}
